form(
	method='post',
	action='/device',
	enctype='application/x-www-form-urlencoded')
	table
		tr
			td.neutral(colspan='2')
				h3= title
				input#save(type='submit',value='Save')
				input(type='hidden',name='hwAddress',value= device.hwAddress)
				input(type='hidden',name='inetAddress',value= device.inetAddress)
		tr
			-if(device.status == 'online')
				td.ok(colspan='2') Online
				input(type='hidden',name='action',value='update')
				input(type='hidden',name='_id',value= device._id)
			-if(device.status == 'offline')
				td.error(colspan='2') Offline
				input(type='hidden',name='action',value='update')
				input(type='hidden',name='_id',value= device._id)
			-if(device.status == 'noconf')
				td.warn(colspan='2') New Device
				input(type='hidden',name='action',value='add')
		tr
			td.neutral.editLabel Device Name
			td.neutral
				input(type='text',name='name',value=device.name)		
		tr
			td.neutral.editLabel MAC Address
			td.neutral.link(onclick='window.location.href=\'http://' + device.inetAddress + '\'')
				= device.hwAddress
		tr
			td.neutral.editLabel IP Address
			td.neutral= device.inetAddress
		tr
			td.neutral.editLabel Location
			td.neutral
				input(type='text',name='location',value=device.location)
		tr
			td.neutral.editLabel Description
			td.neutral
				input(type='text',name='description',value=device.description)
		tr
			td(rowspan= device.ports.length + 1).neutral Ports
			td.neutral &nbsp;
				-if(action == 'update')
					input#editAddPort(
							type='button',
							value='Add Port',
							onclick='window.location=\'/port/add/' + device._id + '\'')
		each port in device.ports
			tr
				td(colspan='2').neutral= port.name
					input.link(type='button',value='Remove',onclick='window.location=\'/port/' + port._id + '/remove?next=/device/' + device._id + '/edit\'')
